def extract_credentials(file_path):
    with open(file_path, 'r') as file:
        line = file.readline().strip()  # 读取文件的第一行
        # 提取用户名和密码
        username = line.split("Username: ")[1].split(", Password: ")[0]
        password = line.split(", Password: ")[1]
        return username, password

def extract_captcha(file_path):
    with open(file_path, 'r') as file:
        line = file.readline().strip()  # 读取文件的第一行
        # 提取验证码
        captcha = line.split("Captcha: ")[1]
        return captcha

def clean_content(file_path):
    with open(file_path, 'w') as file:
        content = ""
        file.write(content)

# 文件路径
credentials_file = 'credentials.txt'
captcha_file = 'captcha.txt'

def get_acc():
    # 提取用户名和密码
    username, password = extract_credentials(credentials_file)
    print(f"用户名: {username}, 密码: {password}")
    #清理文件
    clean_content(credentials_file)
    return username, password

def get_catpcha():
    # 提取验证码
    captcha = extract_captcha(captcha_file)
    print(f"验证码: {captcha}")
    clean_content(captcha_file)
    return captcha